package Dao;

import Table.Book;
import Utils.DruidUtils;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class InsertBorrowBookDao {
    public static void Insert(int book_id, int user_id) {
        Connection conn = null;
        PreparedStatement pstmt = null;
        try {
            conn = DruidUtils.getConnection();
            String sql = " insert into borrowbook value (?,?)";
            pstmt = conn.prepareStatement(sql);
            pstmt.setInt(1, user_id);
            pstmt.setInt(2, book_id);
            int i = pstmt.executeUpdate();
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        } finally {
            DruidUtils.close(pstmt, conn);
        }

    }
}
